﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test1
{
    class Program
    {
        static void Main(string[] args)
        {
            /*
            Buyer buyer1 = new Buyer("小红");
            Buyer buyer2 = new Buyer("小明");
            Buyer buyer3 = new Buyer("小强");

            OrderDetails orderDerails1 = new OrderDetails(new Goods("juice", 10), 3);
            OrderDetails orderDerails2 = new OrderDetails(new Goods("ball", 15), 2);
            OrderDetails orderDerails3 = new OrderDetails(new Goods("mouse", 44), 4);
            OrderDetails orderDerails4 = new OrderDetails(new Goods("water", 3), 5);
            OrderDetails orderDerails5 = new OrderDetails(new Goods("chocolate", 108), 6);

            OrderDetails[] orderDetailsArray1 = { orderDerails1, orderDerails5 };
            OrderDetails[] orderDetailsArray2 = { orderDerails2, orderDerails4 };
            OrderDetails[] orderDetailsArray3 = { orderDerails2, orderDerails3, orderDerails4 };
            Order order1 = new Order(1, buyer1, orderDetailsArray1);
            Order order2 = new Order(2, buyer2, orderDetailsArray2);
            Order order3 = new Order(3, buyer3, orderDetailsArray3);
            Order order4 = new Order(4, buyer1, orderDetailsArray2);

            OrderService orderService = new OrderService();
            orderService.add(order1);
            orderService.add(order2);
            orderService.add(order3);
            orderService.add(order4);
            */
            OrderService orderService = new OrderService();
            orderService.Import();
            Console.WriteLine("当前所有订单:");
            orderService.outPut();
            //orderService.Export();
            Console.WriteLine("按价格排序后的所有订单:");
            orderService.sortByPrice();
            orderService.outPut();
            Console.WriteLine("删除订单编号为2的订单:");
            orderService.remove(2);
            Console.WriteLine("当前所有订单:");
            orderService.outPut();
            Console.WriteLine("查询编号为3的订单:");
            Console.WriteLine(orderService.querybyOrderId(3).ToString());
            Console.WriteLine("查询小红的订单:");
            foreach (Order order in orderService.querybyBuyerName("小红"))
            {
                Console.WriteLine(order.ToString());
            }
            Console.ReadKey();
        }
    }
}
